#include <iostream>
#include "Comm.hpp"

int main()
{
    key_t k = ftok(gpath.c_str(),gprojId);//创建key
    if(k < 0)
    {
        std::cerr<<"ftok error"<<std::endl;
        return 1;
    }
        std::cout<<"ftok: "<<ToHex(k)<<std::endl;

    int shmid = ::shmget(k,gshmsize,IPC_CREAT | IPC_EXCL);//创建共享内存
    if(shmid < 0)
    {
        std::cerr<<"shmget error"<<std::endl;
        return 2;
    }
        std::cout<<"shmget: "<<shmid<<std::endl;

        //删除共享内存
        shmctl(shmid,IPC_RMID,nullptr);
    return 0;
}